package cn.seqdata.jackson;

import java.io.IOException;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;

import cn.seqdata.util.BytesUtils;

public class BytesDeserializer extends StdDeserializer<byte[]> {
	private static final long serialVersionUID = 1L;

	protected BytesDeserializer() {
		super(byte[].class);
	}

	@Override
	public byte[] deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
		return BytesUtils.decode(jp.getText());
	}
}
